<template>
  <slot v-if="show" />
  <template v-else>
    <div class="swiper">
      <van-skeleton title v-if="name == 'home_slider'" />
    </div>

    <div class="goodslist" v-if="name == 'home_goods'">
      <van-skeleton title :row="3" />
      <van-skeleton title :row="3" />
      <van-skeleton title :row="3" />
      <van-skeleton title :row="3" />
    </div>

    <div class="collection" v-if="name == 'collection_list'">
      <div class="item">
        <div class="left">
          <van-skeleton title class="sk1" />
        </div>
        <div class="right">
          <van-skeleton title row="2" />
        </div>
      </div>

      <div class="item">
        <div class="left">
          <van-skeleton title class="sk1" />
        </div>
        <div class="right">
          <van-skeleton title row="2" />
        </div>
      </div>

      <div class="item">
        <div class="left">
          <van-skeleton title class="sk1" />
        </div>
        <div class="right">
          <van-skeleton title row="2" />
        </div>
      </div>
    </div>
  </template>
</template>

<script>
export default {
  name: "all-skeleton",
  props: {
    show: {
      type: Boolean,
    },
    name: {
      type: String,
    },
  },
  setup(props) {
    console.log("name:", props.name, "show:", props.show);
  },
};
</script>

<style lang="scss">
.swiper {
  .van-skeleton__title {
    width: 100%;
    height: 2.8846rem;
    border-radius: 0.3846rem;
  }
}

.goodslist {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0.25rem;
  .van-skeleton__content {
    margin-bottom: 0.3846rem;
  }
  .van-skeleton__title {
    border-radius: 0.3846rem;
    width: 2.8846rem;
    height: 2.8846rem;
  }
}

.collection {
  display: flex;
  flex-direction: column;
  .item {
    display: flex;
    justify-content: start;
    padding-top: .3846rem;
    .left {
      .van-skeleton__title {
        border-radius: 0.3846rem;
        width: 2rem;
        height: 2rem;
      }
    }
    .right {
      .van-skeleton__title {
        width: 4rem;
      }
    }
  }
}
</style>
